home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 21.zip / BS1 part 21 / Professional Page v4.0 (1993)(Gold Disk)(Disk 1 of 4)[HD].7z / Professional Page v4.0 (1993)(Gold Disk)(Disk 1 of 4)[HD].adf / rexx.lzh / MakeBoxIntoColumns.pprx < prev    next >
Text File  |  1992-03-13  |  3KB  |  115 lines

  1. /*
  2. @BMakeBoxIntoColumns  @P@ICopyright Gold Disk Inc., January, 1992
  3.  
  4. This Genie will create several columns in a box. You will be prompted to enter the number of columns required and the gutter. You may also separate the columns by vertical dividers and put a border around each column.
  5. */
  6. arg box, cols, gutter, vert, borders, link
  7. borders = upper(borders)
  8. vert    = upper(vert)
  9. link    = upper(link)
  10. address command
  11. call SafeEndEdit.rexx()
  12. call ppm_AutoUpdate(0)
  13. units = ppm_GetUnits()
  14. if units = 3 then
  15.     call ppm_SetUnits(1)
  16.  
  17. signal on halt
  18. signal on break_c
  19. signal on break_e
  20. signal on break_d
  21.  
  22. rval = 1
  23.  
  24. if box = '' then
  25. do
  26.     cr  = '0a'x
  27.  
  28.     box = ppm_ClickOnBox("Select box in which to create columns..")
  29.     if box = 0 then exit_msg()
  30.  
  31.     form = "Number of Columns"cr"Gutter"cr"Column dividers Y/N"cr"Box Borders Y/N"cr"Link columns Y/N"
  32.     form = upper(ppm_GetForm("Enter options", 8, form))
  33.  
  34.     if form = '' then exit_msg()
  35.  
  36.     parse var form cols '0a'x gutter '0a'x vert '0a'x borders '0a'x link
  37.  
  38.     rval = 0
  39. end
  40.  
  41. if ~(datatype(cols,n) & datatype(gutter, n)) | verify(vert||borders||link, "YESNOyesno")~= 0 then
  42.     exit_msg("Invalid Input")
  43.  
  44. if units = 3 then gutter = ppm_ConvertUnits(3,1, gutter)
  45.  
  46. if ppm_GetBoxAngle(box) ~= 0 then exit_msg("Genie does not work on rotated boxes")
  47.  
  48. posn    = ppm_GetBoxPosition(box)
  49. size    = ppm_GetBoxSize(box)
  50. left    = word(posn, 1)
  51. top     = word(posn, 2)
  52. width   = word(size, 1)
  53. height  = word(size, 2)
  54. bottom  = top + height
  55.  
  56. boxwidth = (width - ((cols - 1) * gutter)) / cols
  57.  
  58. newbox  = ppm_CreateBox(left, top, boxwidth, height, 0, )
  59. xoffset = boxwidth + gutter
  60. firstbox = newbox
  61.  
  62. if borders = 'Y' | borders = 'YES' then call ppm_SetBoxFrame(newbox, 1)
  63. do col = 2 to cols
  64.  
  65.     prevbox = newbox
  66.     newbox  = ppm_CloneBox(newbox, xoffset, 0)
  67.  
  68.     if link = 'Y' | link = 'YES' then call ppm_LinkBox(prevbox, newbox)
  69.     if borders = 'Y' | borders = 'YES' then call ppm_SetBoxFrame(newbox, 1)
  70.  
  71. end
  72.  
  73. xoffset = boxwidth + .5 * gutter
  74.  
  75. if vert = 'Y' | vert = 'YES' then
  76. do
  77.     line = ppm_DrawLine(left + xoffset, top, left + xoffset, bottom, )
  78.     xoffset = xoffset + .5 * gutter
  79.  
  80.     do col = 2 to cols - 1
  81.  
  82.         line    = ppm_CloneBox(line, xoffset, 0)
  83.  
  84.     end
  85.  
  86. end
  87.  
  88. if upper(word(ppm_GetBoxInfo(box), 1)) = 'TEXT' then
  89. do
  90.     text = ppm_GetArticleText(box, 1)
  91.     call ppm_TextIntoBox(firstbox, text)
  92. end
  93.  
  94. call ppm_DeleteBox(box)
  95.  
  96.  
  97. if rval then return(ppm_ArtFirstBox(newbox))
  98. exit_msg()
  99.  
  100. break_d:
  101. break_e:
  102. break_c:
  103. halt:
  104.     call exit_msg("User aborted Genie!")
  105.  
  106. exit_msg: procedure expose units
  107. do
  108.     parse arg message
  109.  
  110.     if message ~= '' then call ppm_Inform(1,message,)
  111.    if units = 3 then call ppm_SetUnits(3)
  112.     call ppm_AutoUpdate(1)
  113.     exit
  114. end